//
//  LogBut.swift
//  weibo1
//
//  Created by 李进 on 15/10/15.
//  Copyright © 2015年 李进. All rights reserved.
//

import UIKit

class LogBut: UIButton {

    /*
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func drawRect(rect: CGRect) {
        // Drawing code
    }
    */
    //构造函数
    convenience init(titlt:String, BackiconName: String){
        
        self.init()
        
        setBackgroundImage(UIImage(named: BackiconName), forState: UIControlState.Normal)
        
        setTitle(titlt, forState: UIControlState.Normal)
        
        self.sizeToFit()
        
    }
    
    /// 遍历构造函数
    ///
    /// - parameter title:         title
    /// - parameter fontSize:      fontSize
    /// - parameter color:         color
    /// - parameter backImageName: backImageName
    ///
    /// - returns: UIButton
    convenience init(title: String, fontSize: CGFloat, color: UIColor, backImageName: String?) {
        
        self.init()
        
        setTitle(title, forState: .Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        setTitleColor(color, forState: .Normal)
        
        if let backImgName = backImageName {
            setBackgroundImage(UIImage(named: backImgName), forState: .Normal)
        }
    }

}
